package org.jeecg.modules.manage.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.manage.entity.CaishuiTaskSettle;

import java.util.List;
import java.util.Map;

/**
 * @Description: 任务结算
 * @Author: yfkj
 * @Date:   2023-02-20
 * @Version: V1.0
 */
@InterceptorIgnore(tenantLine = "true")
public interface MCaishuiTaskSettleMapper extends BaseMapper<CaishuiTaskSettle> {

    /**
     * 查询结算总额
     * @param params
     * @return
     */
    public Map<String,Object> queryTaskSettleTotal(@Param("params") Map<String, String> params);

    /**
     * 最近7天结算统计
     * @return
     */
    public List<Map<String,Object>> last7DaysTaskSettleStatistics(@Param("params") Map<String, String> params);

    /**
     * 最近30天结算统计
     * @return
     */
    public List<Map<String,Object>> last30DaysTaskSettleStatistics(@Param("params") Map<String, String> params);

    /**
     * 最近一年结算统计
     * @return
     */
    public List<Map<String,Object>> lastOneYearTaskSettleStatistics(@Param("params") Map<String, String> params);

    /**
     * 根据订单编号（业务参考号）查询已审核、发放中的任务结算信息
     * @param orderNo
     * @return
     */
    @Select("SELECT * FROM caishui_task_settle WHERE `status` = 2 AND extend_status = 1 AND order_no = #{orderNo}")
    public CaishuiTaskSettle queryTaskSettleByOrderNo(@Param("orderNo") String orderNo);

}
